package com.youge.gmall.service.impl;

import com.youge.gmall.bean.UserAddress;
import com.youge.gmall.service.OrderService;
import com.youge.gmall.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author: hcf
 * @qq: 46914685
 * @email: 46914685@qq.com
 * @date: 2020-10-13 20:16
 */

/**
 * 1.将服务提供者注册到注册中心(暴露服务)
 * 1)导入dubbo依赖以及操作zookeeper的客户端(curator)
 * 2)配置服务提供者
 * <p>
 * <p>
 * 2.让服务消费者去注册中心订阅服务提供者的服务
 */
@Service
public class OrderServiceImpl implements OrderService {

    @Autowired
    UserService userService;

    @Override
    public List<UserAddress> initOrder(String userId) {
        System.out.println("用户id:" + userId);
        //1.查询用户的收货地址
        List<UserAddress> userAddressList = userService.getUserAddressList(userId);
        for (UserAddress userAddress : userAddressList) {
            System.out.println(userAddress.getUserAddress());
        }
    }
}
